import math


class Point:
    def __init__(self, x=0, y=0):  # 构造方法
        self.x = x
        self.y = y

    def __str__(self):  # 字符串化
        return '（%d,%d)' % (self.x, self.y)

    def dist(self, other):  # 普通方法
        return math.hypot(self.x - other.x, self.y - other.y)

    def __add__(self, other):  # 运算符重载
        return Point(self.x + other.x, self.y + other.y)

    def __lt__(self, other):
        return self.x < other.x


p = Point()
q = Point(3)
pq = p.dist(q)
r = Point(3, 4)
print(p + q)

pts = [p, q, r]
for pt in sorted(pts):
    print(pt)
